package com.example.leetcode;

import com.google.common.collect.Lists;
import org.springframework.util.NumberUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.regex.Pattern;

public class Test extends Thread {

    private static ThreadLocalRandom random = ThreadLocalRandom.current();


    private static Object o = new Object();


    public static void test() throws Exception {
        o.wait();
    }

    public static void main(String[] args) throws Exception {
//        Thread a = new Thread(new A());
//        System.out.println("a start");
//        a.start();
//        Thread.sleep(100);
//        System.out.println("a 打断");
//        a.interrupt();
//        System.out.println("main exit");

//        String dateString = "20160901";
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
//        System.out.println("result:" + dateFormat.parse(dateString));
        test();

    }

    private static void  getDifferIndex(List<List<Integer>> list){
        List<Integer> list1 = list.stream()
                .max(Comparator.comparingInt(x -> x.size()))
                .get();
        int t = 0;
        boolean exit = false;
        while(t < list1.size()){
            Integer integer = list1.get(t);
            for (List<Integer> l1:list) {
                if (l1.size() > t){
                    Integer integer1 = l1.get(t);
                    if (!integer1.equals(integer))
                        exit = true;
                }
            }
            if (exit){
                break;
            }
            t++;
        }
        if (!exit){
            System.out.println(0);;
        }else{
            System.out.println(t);
        }
    }

    public static double div(int a,int b) {
        try {
            double i = a / b ;
            System.out.println("try block");
            return i;
        }catch (Exception e) {
            System.out.println("exception");
            throw new RuntimeException("出错了");
        }finally {
            System.out.println("finally");
        }
    }
}


class A implements Runnable {

    @Override
    public void run() {
        while (true) {
            long start = System.currentTimeMillis();
            try {
                System.out.println("准备睡10s");
                Thread.sleep(10000L);
            } catch (InterruptedException e) {
                System.out.println("被打断");
            }

            long end = System.currentTimeMillis();
            System.out.println("耗时："+ (end -start) );
        }
    }
}
